package ModelLayer;



import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class TestUnit1.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class TestUnit1
{
    private ModelLayer.DVDRegister dVDRegis1;

    /**
     * Default constructor for test class TestUnit1
     */
    public TestUnit1()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
        dVDRegis1 = ModelLayer.DVDRegister.getInstance();
        
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
        
    }

    @Test
    public void createDVD()
    {
        assertEquals(true, dVDRegis1.createDVD(12, "Title1", "Artist1", "12/10/2011"));
    }
    

    @Test
    public void createTheSameDVD()
    {
        assertEquals(true, dVDRegis1.createDVD(10, "Title", "Artist", "12/10/2010"));
        assertEquals(false, dVDRegis1.createDVD(10, "Title", "Artist", "12/10/2010"));
    }

    @Test
    public void createCopy()
    {
        assertEquals(true, dVDRegis1.createDVD(11, "Title", "Artist", "12/10/2010"));
        assertEquals(true, dVDRegis1.createCopy(11, "Serial1", "12/11/2011", 12));
    }

    

    @Test
    public void findDVD()
    {
        assertEquals(true, dVDRegis1.createDVD(13, "Title", "Artist", "sdfgfd"));
        assertEquals(true, dVDRegis1.findDVD(13));
    }

    @Test
    public void removeDVD()
    {
        assertEquals(true, dVDRegis1.createDVD(14, "Title", "Artist", "dfgdf"));
        assertEquals(true, dVDRegis1.removeDVD(14));
    }

    @Test
    public void UpdateDVD()
    {
        assertEquals(true, dVDRegis1.createDVD(15, "Title", "Artist", "dfgdf"));
        assertEquals(true, dVDRegis1.updateDVDArtist(15, "Arist2"));
        assertEquals(true, dVDRegis1.updateDVDTitle(15, "Title2"));
        assertEquals(true, dVDRegis1.updateDVDpublicationDate(15, "PublicationDate2"));
    }
}








